package net.esj.basic.dao.ann.criterion;

import net.esj.basic.dao.ann.component.column.AbstractColumn;

public class ColumnCriterion extends PropertyCriterion<AbstractColumn> implements AliasCriterion {

	protected int position;
	
	public ColumnCriterion(AbstractColumn column, int position) {
		super(column);
		this.position = position;
	}

	public ColumnCriterion(AbstractColumn column) {
		super(column);
	}

	@Override
	public String toSql() {
		return value.getColumnName();
	}

	@Override
	public String getAlias() {
		return value.getColumnName().toLowerCase()+"_"+position;
	}
	
}
